<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>添加房卡</title>
     <!--  手机适配 -->
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme/style.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/theme/jquery.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/theme/bootstrap.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/theme/ckform.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/theme/common.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.ext.js"></script>

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
</head>
<body>
<table class="table table-bordered table-hover definewidth m10">
    <tr>
        <td width="30%" style="text-align: right;" class="tableleft"> 代理商名称 </td>
        <td>
        <input type="hidden" name="userId" id="userId" value="${adduser.id}">
        ${adduser.userName} </td>
    </tr>
    
    <tr>
        <td style="text-align: right;" class="tableleft">状&nbsp;&nbsp;态</td>
        <td> <%-- ${playerInfo.status} --%> 正常
        </td>
    </tr>
    <tr>
        <td style="text-align: right;" class="tableleft">房卡余额</td>
        <td>
            ${adduser.totalCard}
        </td>
    </tr>
    <tr>
        <td style="text-align: right;" class="tableleft"> 
        <input type="radio" name="buyCardGroupId" checked="checked" value="1">
        	 套&nbsp;&nbsp; 餐  </td>
        <td> 
        <select name="func" id="func">
	        <option value="1">零售，1元1张</option>
	        <option value="13">10元12张，送1张</option>
	        <option value="40">30元36张，送4张</option>
	        <option value="90">60元80张，送10张</option>
	        <option value="180">100元160张，送20张</option>
        </select>
         </td>
    </tr>
    <tr>
        <td style="text-align: right;" class="tableleft"> 
        <input type="radio" name="buyCardGroupId" value="2" >
        	 自定义  </td>
        <td><input type="text" name="card" id="card" value="0"/></td>
    </tr>
    <tr>
        <td style="text-align: right;" class="tableleft"> 赠&nbsp;&nbsp;送  </td>
        <td><input type="text" name="awardCard" id="awardCard" value="0"/></td>
    </tr>
    <tr>
        <td style="text-align: right;" class="tableleft"> 备&nbsp;&nbsp;注  </td>
        <td><input type="text" name="remark" id="remark"/></td>
    </tr>
    <tr>
        <td class="tableleft"></td>
        <td>
            <button type="button" id="usersave" class="btn btn-primary" type="button">充值</button> &nbsp;&nbsp;<button type="button" class="btn btn-success" name="backid" id="backid">关闭</button>
        </td>
    </tr>
</table>
</body>
<script>
    $(function () {       
		$('#backid').click(function(){
			var system ={}; 
	        var p = navigator.platform;      
	        system.win = p.indexOf("Win") == 0; 
	        system.mac = p.indexOf("Mac") == 0; 
	        system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);    
	        if(system.win||system.mac||system.xll){
	    		//如果是电脑跳转到弹出框 
	        	parent.layer.close(parent.lindex);
	        }else{  
	    		//如果是手机,跳转到页签
	    		window.location.href="${pageContext.request.contextPath}/admin/user_next_info.html";
	        }
		 });

		
		$('#usersave').click(function(){
			$('#usersave').attr('disabled',"true"); //添加disabled属性 
			var userId = $("#userId").val();
			var card = $("#card").val();
			var awardCard = $("#awardCard").val();
			var remark =$("#remark").val();
			var func = $('#func option:selected').val();
			var buyCardGroupId = $('input[name="buyCardGroupId"]:checked').val();
			if(card==""&&func==""){
				layer.alert("请填写充值信息");
				return;
			}
			$.post("${pageContext.request.contextPath}/admin/card_user_add_save.html",
		        {"userId":userId,"card":card,"awardCard":awardCard
				,"remark":remark,"func":func,"buyCardGroupId":buyCardGroupId},
		       function(data){
		            	var json = eval("("+data+")");
						$('#usersave').removeAttr("disabled");  //移除disabled属性 
						if(json.statusCode =='200'){
							layer.msg(json.message, {icon: 1});
							setTimeout("closewind()",2000);
						}else{
    						layer.msg(json.message, {shift: 6});
    					}
						
		      });
		 });
    });
    function closewind(){
    	parent.layer.close(parent.lindex);
    }
</script>
</html>